package com.lmk.ms.common.vo.auth;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * JWT用户信息
 *
 * @author laomake@hotmail.com
 * @version 1.0
 * @date 2021/07/13
 */
@Data
@NoArgsConstructor
@Schema(description = "JWT用户")
public class JwtUser implements Serializable {

    /**
     * 用户ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "用户ID")
    private Long id;

    /**
     * 手机号
     */
    @Schema(description = "手机号")
    private String mobile;

    /**
     * 登录名
     */
    @Schema(description = "用户名")
    private String username;

    public JwtUser(LoginUser loginUser) {
        this.id = loginUser.getId();
        this.mobile = loginUser.getMobile();
        this.username = loginUser.getUsername();
    }
}

